<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="zh" data-theme="dark">
<%-- 导入头部信息 --%>
<c:set var="pageTitle" value="${requestScope.forwardBefore == '/login' ? '登录页' : '注册页'}" scope="page"/>
<%@include file="/include/head_libs.jsp" %>

<body>
<%-- 导航栏信息 --%>
<div class="h-16 bg-base-200">
    <jsp:include page="/include/web_header.jsp" flush="true"/>
</div>

<%-- 主内容区域 --%>
<div class="min-h-[calc(100vh-64px)] relative flex items-center justify-center">
    <%-- 背景图 --%>
    <%@include file="comp_background.jsp" %>

    <c:if test="${sessionScope.errMsg != null}">
        <div id="errorAlert" class="fixed top-4 right-4 z-50">
            <div class="alert alert-error shadow-lg w-48">
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg"
                         class="h-6 w-6 shrink-0 stroke-current"
                         fill="none"
                         viewBox="0 0 24 24">
                        <path stroke-linecap="round"
                              stroke-linejoin="round"
                              stroke-width="2"
                              d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z">
                        </path>
                    </svg>
                    <span>Error: ${sessionScope.errMsg}</span>
                </div>
            </div>
        </div>
        <script>
            <%
                session.removeAttribute("errMsg");
            %>
            setTimeout(function () {
                $('#errorAlert').hide();
            }, 3000);
        </script>
    </c:if>

    <%-- 登录|注册 --%>
    <c:choose>
        <c:when test="${requestScope.forwardBefore == '/login'}">
            <%@include file="comp_login.jsp" %>
        </c:when>
        <c:when test="${requestScope.forwardBefore == '/register'}">
            <%@include file="comp_register.jsp" %>
        </c:when>
    </c:choose>
</div>
<%--主题控制--%>
<%@include file="/include/hover_theme_controller.jsp" %>
</body>
</html>